package com.bestcem.xm.member.service.dto;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * 套餐内容DTO
 *
 * @author ympan <yuming.pan@idiaoyan.com>
 * @version v1.0
 * @date 23:00 2021/12/14
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PackageDTO {

    /**
     * 套餐id，java项目用，非grpc获取，且json转换时会忽略
     */
    @JSONField(serialize = false)
    private String packageId;
    @JSONField(name = "datasource_quota")
    private Integer datasourceQuota;
    @JSONField(name = "member_ind_quota")
    private Integer memberIndQuota;
    @JSONField(name = "project_quota")
    private Integer projectQuota;
    @JSONField(name = "rspd_quota")
    private Integer rspdQuota;
    @JSONField(name = "user_quota")
    private Integer userQuota;
    @JSONField(name = "member_group_quota")
    private Integer groupQuota;
    @JSONField(name = "pack_perm")
    private PackPerm packPerm;

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class PackPerm {
        @JSONField(name = "ACTION")
        private Module action;
        @JSONField(name = "BI")
        private Module bi;
        @JSONField(name = "CUSTOMER_JOURNEY")
        private Module customerJourney;
        @JSONField(name = "LIB")
        private Module lib;
        @JSONField(name = "MEMBER")
        private Module member;
        @JSONField(name = "PROJECT")
        private Module project;
        @JSONField(name = "USER")
        private Module user;
        @JSONField(name = "OPENPLATFORM")
        private Module openPlatform;

        @Data
        @AllArgsConstructor
        @NoArgsConstructor
        public static class Module {
            @JSONField(name = "SubModule")
            private List<SubModule> subModules;
            private String id;

            @Data
            @AllArgsConstructor
            @NoArgsConstructor
            public static class SubModule {
                @JSONField(name = "Domain")
                private List<Domain> domains;
                private String code;
                private String id;

                @Data
                @AllArgsConstructor
                @NoArgsConstructor
                public static class Domain {
                    private String code;
                    private String id;
                    @JSONField(name = "is_quota")
                    private Boolean isQuota;
                }
            }
        }
    }
}